package com.cait.dutyfree.dataaccess.impl;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.cait.dutyfree.dataaccess.ComplainServiceDao;
import com.cait.dutyfree.exception.DutyFreeException;
import com.cait.dutyfree.pojo.Complain;

public class ComplainServiceDaoImpl extends HibernateDaoSupport implements ComplainServiceDao {

	public boolean addcmplin() {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean editcmplin() {
		// TODO Auto-generated method stub
		return false;
	}

	public List<Complain> findcmplin()  {
		try{
			ArrayList<Complain> complains = new ArrayList<Complain>();
			DetachedCriteria criteria = DetachedCriteria.forClass(Complain.class);
			@SuppressWarnings("rawtypes")
			List comlist = getHibernateTemplate().findByCriteria(criteria);
			System.out.println(comlist+"fffff");
			
			if ((comlist != null) && (comlist.size() > 0)) {
				for(int i = 0; i < comlist.size(); i++){
					complains.add((Complain) comlist.get(i));
				}
				//System.out.println(cm[0]+"fffyyyyff");
				return complains;
			}
			return null;
		}catch (Exception e) {
			logger.warn("During fetch all users ");
			return null;
			
		}
	}

	public boolean viewcmplin() {
		// TODO Auto-generated method stub
		return false;
	}

	
	

}
